#!/usr/local/bin/python
import os
import cherrypy
from comm.proj import * 
from wsgi.admin.wsgi_user import * 

class Default:
	def index(self, *argv, **kwds):
		import sys
		return Proj.HTML('admin/index.html', all_path=sys.path) 
	index.exposed = True
	
root = Default()
root.user = WSGUser()


cherrypy.config.update({
'error_page.501':Proj.Handle_ProjError,
'tools.sessions.on':True,
'tools.sessions.timeout':60,
'tools.session.storage_type':'file',
'tools.session.storage_path':os.path.join(Conf.PATH_BASE,'/storage/sessions/'),
})


application = cherrypy.tree.mount(root, "/admin" ) 
#application = cherrypy.tree.mount(root, "/admin", config=os.path.join(Conf.PATH_BASE, 'conf/admin.conf') )
try:
	pass #cherrypy.engine.start(blocking=False)
finally:
	pass


def start():
	'''
	cherrypy.config.update({
			'log.error_file': os.path.join(os.path.dirname(__file__), 'site.log'),
			'environment': 'production',
			})
	'''
	'''
	try:
		WSGIServer(application).run()
	finally:
		cherrypy.engine.stop()
	'''


if __name__ == "__main__":
	start()

